<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<link href="/res/back/css/base.css" rel="stylesheet" type="text/css" />
<link href="/res/third/bootstrap3/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
<script src="/res/common/js/jquery.1.9.1.min.js" type="text/javascript"></script>
<script src="/res/third/bootstrap3/bootstrap.autocomplete.js" type="text/javascript"></script>
<script src="/res/third/artDialog/jquery.artDialog.js" type="text/javascript"></script>
<script src="/res/third/validate/jquery.validate.js" type="text/javascript"></script>
<script src="/res/third/easyUI/jquery.easyui.min.js" type="text/javascript"></script>
<script src="/res/third/easyUI/locale/easyui-lang-zh_CN.js" type="text/javascript"></script>
<script type="text/javascript" src="/res/third/ueditor/ueditor.config.js"></script>
<script type="text/javascript" src="/res/third/ueditor/ueditor.all.js"></script>
<script type="text/javascript" src="/res/third/ueditor/lang/zh-cn/zh-cn.js"></script>
<script type="text/javascript">
	
</script>
<style type="text/css">
</style>

</head>

<body>
<form id="editform" method="post" action="/recommendbrand/o_edit.do" class="form-horizontal" role="form">
	<input type="hidden" name="id" value="${recommendbrand.id}">
	<table class="table table-hover table-bordered">
		<tr>
			<th width="10%">公司名称</th>
			<td width="25%"><input class="form-control" name="companyName" required="required" value="${recommendbrand.companyName}"/></td>
			<th width="10%">品牌名称</th>
			<td width="25%"><input class="form-control" name="brandName" required="required" value="${recommendbrand.brandName}"/></td>
		</tr>
	
		<tr>
			<th>是否推荐到首页</th>
			<td><input type="radio"  name="upToIndex" value="1" required [#if recommendbrand.upToIndex==1]checked="checked"[/#if]>是&nbsp;&nbsp;&nbsp;&nbsp;
				<input type="radio"  name="upToIndex" value="0" [#if recommendbrand.upToIndex==0]checked="checked"[/#if]>否</td>
			<th>链接地址</th>
			<td><input class="form-control"  required="required" name="urlPath" value="${recommendbrand.urlPath}"/></td>
		</tr>
		<tr>
			<th>产品图&nbsp;&nbsp;&nbsp;&nbsp;<button onclick="upload()" type="button" class="btn btn-info">添加/修改图片</button></th>
			<td>	
				<input class="form-control"  readonly name="productImg" id="productImg" required="required" value="${recommendbrand.productImg}"/>
			</td>
			<th>品牌logo&nbsp;&nbsp;&nbsp;&nbsp;<button onclick="uploadlogo()" type="button" class="btn btn-info">添加/修改图片</button></th>
			<td>
				<input class="form-control"  readonly name="logo" id="logo" required="required" value="${recommendbrand.logo}"/>
			</td>
		</tr>
		<tr>
			<th>品类</th>
			<td colspan='3'">
				[#list categorys as category]
					<input type="checkbox" required="required" name="brandCategory" value="${category.id}" required minLength="1"
					[#list cats as cat]
						[#if category.id?string == cat]checked='checked'[/#if]
					[/#list]/>${category.name}&nbsp;&nbsp;
				[/#list]
			</td>
		</tr>
	</table>
</form>
<div class="center-block">
	<button class="btn btn-success" onclick="edit()">提交</button>
</div>

</body>
</html>
<script type="text/javascript">
	$().ready(function() {
	    $("#editform").validate();
	});

	var editor;
	$(function() {

		var option = {
			theme : "default",
			lang : "zh-cn",
			initialFrameWidth : 420,
			initialFrameHeight : 150,
			autoHeightEnabled : false,
			pasteplain : true,//默认纯文本格式粘贴,
			elementPathEnabled : false,
			focus : false,//初始化时不让编辑器获取焦点
			toolbars : [ [ 'fullscreen', 'source', 'undo', 'redo', 'bold',
					'indent', 'italic', 'underline', 'strikethrough',
					'justifyleft', 'justifyright', 'justifycenter',
					'justifyjustify', 'rowspacingtop', 'rowspacingbottom',
					'lineheight', 'removeformat', '|', 'fontfamily',
					'fontsize', 'forecolor', 'backcolor', 'insertorderedlist',
					'insertunorderedlist', 'insertimage', 'emotion',
					'inserttable', 'mergeright', 'mergedown', 'deleterow',
					'deletecol', 'splittorows', 'splittocols', 'splittocells',
					'deletecaption', 'mergecells', 'deletetable' ] ]
		};
		editor = UE.getEditor('container', option);
		editor = UE.getEditor('container2', option);
		editor = UE.getEditor('container3', option);
		$("span[class='combo']").css({
			"height" : "30px",
			"border-radius" : "4px",
			"width" : "180px"
		});
		$("span[class='combo-arrow']").css({
			"height" : "30px"
		});
		$("input[class^='combo-text']").css({
			"height" : "30px",
			"width" : "160px"
		});

	});

	function edit() {
		$("#editform").submit();
	};
	
	function upload() {
		exceldialog = art.dialog.uploadFile("上传图片", {
			callback : "uploadcallback",
			userpath : "admin",
			extensions : "gif,jpg,png,jepg"
		});
	}
	function uploadcallback(response) {
		exceldialog.close();
		$("#productImg").val(response.url);
	}
	
	function uploadlogo() {
		exceldialog = art.dialog.uploadFile("上传图片", {
			callback : "uploadlogocallback",
			userpath : "admin",
			extensions : "gif,jpg,png,jepg"
		});
	}
	function uploadlogocallback(response) {
		exceldialog.close();
		$("#logo").val(response.url);
	}

</script>
